<template>
  <view class="feedback">
    <up-textarea
      v-model="feedback"
      placeholder="请留下您的宝贵建议~"
      count
      :height="180"
    ></up-textarea>
    <view class="btn" @click="onSubmit"> 提交 </view>
  </view>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { compair } from '@/api/home'

const feedback = ref('')

const onSubmit = async () => {
  const res = await compair({ complainDesc: feedback.value })
  if (res.code === 200) {
    uni.showToast({ title: '提交成功', icon: 'success' })
    feedback.value = ''
  } else {
    uni.showToast({ title: '提交失败', icon: 'none' })
  }
}
</script>

<style lang="scss" scoped>
.feedback {
  padding: 20rpx;
  .btn {
    width: 80vw;
    height: 80rpx;
    margin: 0 auto;
    border-radius: 50rpx;
    line-height: 80rpx;
    color: #fff;
    text-align: center;
    font-size: 36rpx;
    margin-top: 10vh;
    background-color: #fca364;
  }
}

::v-deep .u-textarea {
  border: none !important;
  border-radius: 20rpx;
}
::v-deep .u-textarea__count {
  margin-bottom: 10rpx;
}
</style>
